package org.xempot.example;

import java.io.File;
import java.io.FileOutputStream;

import org.xempot.xform.Transform;

/**
 * Basic example using the food.xml as the data to produce a Comma Separated File. 
 * @author brook
 *
 */
public class CsvExample {
	public static void main(String[] args) {
		setup();
		try {
			Transform transform = new Transform(ClassLoader.getSystemResourceAsStream("exampledata/Food_xform_2.xml"),
					new FileOutputStream("example/food.csv"), ClassLoader.getSystemResourceAsStream("exampledata/Food.xml"));

			transform.process();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private static void setup() {
		File f = new File("example");
		if (!f.exists()) {
			f.mkdirs();
			f.mkdir();
		}
	}
}

